<template>
	<view class="page page-fill">
		<u-navbar :is-back="false" :title="title" title-color="white" :background="background"></u-navbar>
		<view class="header">
			<view v-if="userIsLogin">
				<image class="face" :src="userInfo.avatarUrl" @click="showface"></image>	
			</view>
			<view v-else>
				<image class="face" src="../../static/default_head.png"></image>
			</view>
			
			<view class="info-wapper" v-if="userIsLogin">
				<view class="nickname">
					<navigator url="../mineinfo/mineinfo">
						{{userInfo.nickName}}
					</navigator>	
				</view>
			</view>
			<view v-else>
				<navigator url="../registLogin/registLogin">
					<view class="nickname regist-login">
						注册/登录
					</view>
				</navigator>
			</view>
			
			<view class="set-wapper" v-if="userIsLogin">
				<navigator url="../mineinfo/mineinfo">
					<image src="../../static/settings.png" class="settings"></image>
				</navigator>	
			</view>
			
		</view>
		
		<view class="aboutme" v-if="userIsLogin">
				<navigator  url="../myfind/myfind">
                    <view class="footer-words" >
                    	我找失主
                    </view>
                </navigator>
				<navigator  url="../mylost/mylost">
				    <view class="footer-words" >
				    	我找失物
				    </view>
				</navigator>
				<navigator  url="../calladmin/calladmin">
				    <view class="footer-words" >
				    	联系客服
				    </view>
				</navigator>
				<navigator  url="../aboutus/aboutus">
				    <view class="footer-words" >
				    	关于我们
				    </view>
				</navigator>
				
				
				
		</view>
		
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				title:"我的",
				background:{
					backgroundImage:'linear-gradient(to top, #ffd655 0%, #fda085 100%)',
					/* background-image: linear-gradient(to top, ffd655#fddb92 0%, #d1fdff 100%); */
				},
				userIsLogin: false,
				userInfo: {}
			}
		},
		onShow() {
			var me =this;
			var userInfo = uni.getStorageSync("globalUser").user;
			if (userInfo !=null && userInfo !="" && userInfo !=undefined){
				me.userIsLogin = true;
				me.userInfo = userInfo;				
			}else{
				me.userIsLogin=false;
				me.userInfo = {};
			}
		},
		onLoad() {
			
		},
		methods: {
			showface(){
				var userInfo = uni.getStorageSync("globalUser").user;
				var faceArr = [];
				faceArr.push(userInfo.avatarUrl);
				uni.previewImage({
					urls: faceArr,
					current: faceArr[0]
				})
			}
		}
	}
</script>

<style>
@import url("mine.css");

</style>
